<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    input {
      color: #ccc;
    }
  </style>
</head>
<body>
  <input type="text" value="手机">

  <script>
    var input = document.querySelector('input')

    // onclick 点击
    input.onblur = function() {  // 失去焦点
      this.style.color = '#ccc'

      if(this.value === '') {
        this.value = '手机'
      }
    }

    input.onfocus = function() {  // 获取焦点
      this.style.color = '#333'
      
      if( this.value === '手机' ) {
        this.value = ''
      }
    }
  </script>
</body>
</html>